﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using BehaviorFramework;

namespace WpfTestApplication
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            var dc = new Dataclass()
            {
                Name = "Lance",
                LastName = "Wynn",
                MiddleInitial = "J",
                Age = 36,
                FavoriteColor="Red"
            };
            //Two ways to attach behavior, the first being to create the behavior class and pass it a dataclass.
			//the second is to use the AttachBehavior extensions and allow the injector to new up an instance of the behavior class.

			//var bi = new BehaviorClass(dc).ApplyObservableBehaviorToModel(new BehaviorClass2()); 
			var bi = dc.AttachBehavior<BehaviorClass>().AttachBehavior<BehaviorClass2>();
            
			//Create the new main window.
            var mw = new MainWindow();
            App.Current.MainWindow = mw;

            //Bind the dataContext to the BehaviorInjector.VieModel
            mw.DataContext = bi.ViewModel;
            mw.Show();
        }
    }
}
